package WTE;

import java.util.Scanner;

public class Demo_07 {

    /**
     * Fibonacci数列(垃圾题)
     */
    public int method01(){
        Scanner in = new Scanner(System.in);
        // 目标
        int target = in.nextInt();

        int f1 = 0;
        int f2 = 1;

        while(true){
            if(target >= f1 && target <= f2){
                int k1 = target - f1;
                int k2 = f2 - target;
                return Math.min(k1, k2);
            }
            int sum = f1 + f2;
            f1 = f2;
            f2 = sum;
        }


    }

    /**
     * 合法括号序列判断
     */
    public boolean chkParenthesis(String A, int n) {
        int left = 0;
        int right = 0;
        for (int i = 0;i < n;i++){
            if(A.charAt(i) == '('){
                left++;
            }else if(A.charAt(i) == ')'){
                right++;
            }else{
                return false;
            }
        }
        return left == right;
    }
}
